<template>
  <ul class="todo-list">
    <!-- completed: 完成的类名 -->
    <li
      :class="{completed : item.state === true ? true : false}"
      v-for="(item, index) in stateList"
      :key="index"
    >
      <div class="view">
        <input
          class="toggle"
          type="checkbox"
          @click="$store.commit('tasklist/setTaskState', index)"
          :checked='item.state'
        />
        <label>{{ item.taskName }}</label>
        <button class="destroy" @click="$store.commit('tasklist/delTask', index)"></button>
      </div>
    </li>
  </ul>
  
</template>

<script>
import { mapGetters } from 'vuex'
export default {
  computed: {
    ...mapGetters(['stateList'])
  },
  methods: {}
}
</script>
